<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8" import="com.zhlb.zfba.common.config.Global" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%
	pageContext.setAttribute("APP_PATH", request.getContextPath());
%>
<%
String GrantAuthURL=Global.getConfig("GrantAuthURL");
String RevokeAuthURL=Global.getConfig("RevokeAuthURL");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>警员信息</title>
<link href="${APP_PATH}/static2/css/style.css" rel="stylesheet"
	type="text/css" />
<link href="${APP_PATH}/static2/css/xilaxuanze.css" rel="stylesheet"
	type="text/css" />
<script type="text/javascript" src="${APP_PATH}/static2/js/jquery.js"></script>
<script src="${APP_PATH}/static2/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
<link href="${APP_PATH}/static2/jquery-jbox/2.3/Skins/Bootstrap/jbox.min.css" rel="stylesheet"/>
<script src="${APP_PATH}/static2/jquery-jbox/2.3/jquery.jBox-2.3.min.js" type="text/javascript"></script>
<script type="text/javascript" src="${APP_PATH}/static2/js/mycommon.js"></script>
<script language="javascript">
jQuery(function() {
		//导航切换
		$(".imglist li").click(function() {
			$(".imglist li.selected").removeClass("selected")
			$(this).addClass("selected");
		})
	})
</script>

<script>
	$(function() {
		//全选或全不选
		$("#all").click(function() {
			if (this.checked) {
				$("#list :checkbox").attr("checked", true);
			} else {
				$("#list :checkbox").attr("checked", false);
			}
		});
		//全选  
		$("#selectAll").click(function() {
			$("#list :checkbox,#all").prop("checked", true);
		});
		//全不选
		$("#unSelect").click(function() {
			$("#list :checkbox,#all").prop("checked", false);
		});
		//反选 
		$("#reverse").click(function() {
			$("#list :checkbox").each(function() {
				$(this).prop("checked", !$(this).prop("checked"));
			});
			allchk();
		});

		//设置全选复选框
		$("#list :checkbox").click(function() {
			allchk();
		});

		//获取选中选项的值
		$("#getValue").click(function() {
			var valArr = new Array;
			$("#list :checkbox[checked]").each(function(i) {
				valArr[i] = $(this).val();
			});
			var vals = valArr.join(',');
			alert(vals);
		});
	});
	function allchk() {
		var chknum = $("#list :checkbox").size();//选项总个数
		var chk = 0;
		$("#list :checkbox").each(function() {
			if ($(this).prop("checked") == true) {
				chk++;
			}
		});
		if (chknum == chk) {//全选
			$("#all").prop("checked", true);
		} else {//不全选
			$("#all").prop("checked", false);
		}
	}
</script>
<script>
/* 	$(function() {
		$("#shanchu").click(function() {
			$("input[name='test']:checked").each(function() { // 遍历选中的checkbox
				n = $(this).parents("tr").index(); // 获取checkbox所在行的顺序
				$("table#list").find("tr:eq(" + n + ")").remove();
			});
		});
	}); */
</script>
<script type="text/javascript">
var totalrecord;
	$(document).ready(function() {
		$("#police_add_modal_btn").click(function() {
			$("#policeAddModal form")[0].reset();
			$("#policeAddModal").fadeIn(200);
		});
		//点击修改按钮。弹出修改页面
		$("#police_update_modal_btn").click(function() {
			var checkboxs=$("input:checkbox[name='policeCheckbox']:checked");
			//alert(checkboxs.length);
			if(checkboxs.length!=1){
				alert("请选择一条数据！");
				return false;
			}
			var policeId=checkboxs.attr("dataId");
			//alert(policeId)
			$("#policeUpdateModal form")[0].reset();
			getProjectInfo(policeId);
			$("#policeInfo_upodate_btn").attr("dataId",policeId);
			$("#policeUpdateModal").fadeIn(200);
		});
		//双击行（tr）,弹出修改按钮
		$("#list tr").dblclick(function(){
			//获取双击行的checkbox的dataID
			var checkboxObj=$(this).find("input:checkbox[name='policeCheckbox']");
			var policeId=checkboxObj.attr("dataId");
			$("#policeUpdateModal form")[0].reset();
			getProjectInfo(policeId);
			$("#policeInfo_upodate_btn").attr("dataId",policeId);
			$("#policeUpdateModal").fadeIn(200);
		});
		//点击，添加数据到数据库
		$("#police_add_btn").click(function(){
			if(validate_add_form()==false){
				return ;
			}
			try{
			//授权询问室 S
			var inquestRoomName=$("#add_inquestRoomNo_select").val();
			//alert(inquestRoomName)
			//根据询问室名称 获取房间门禁控制器SN号 门禁控制门号
			var inquestRoomObj=getRoomInfoByName("${APP_PATH}/room/roomInfo/getRoomInfo",inquestRoomName)
			var CardNoStr=$("#policeCardNo1_add_input_id").val();
			var AccessSnStr=inquestRoomObj.roomAccessSN;
			var DoorNoStr=inquestRoomObj.roomAccessDoorNo;
			ploiceAuth('<%=GrantAuthURL%>',CardNoStr,AccessSnStr,DoorNoStr);
			//授权询问室 E
			//保存 S
			document.getElementById("police_add_btn").disabled = true;
			$.ajax({
				url:"${APP_PATH}/per/policeInfo/save",
				type:"post",
				data:$("#policeAddModal form").serialize(),
				success:function(result){
					//alert(result.msg);
					document.getElementById("police_add_btn").disabled = false;
					if(result.code="100"){
						parent.topFrame.location.reload();//刷新top页的在所人数
						$('#policeAddModal').fadeOut(200);
						to_page(1);
					}else{
						/* if(undefined !=reuslt.extend.errorFields.email){
							show_validate_msg("#empName_add_input","error","用户名2-5位中文或6-16位英文和数组的组合");

						}
						if(undefined !=reuslt.extend.errorFields.empName){
							show_validate_msg("#email_add_input","error","邮箱格式不正确");
						} */
					}
					
				},
				error:function(){
					document.getElementById("police_add_btn").disabled = false;
					alert("操作失败：系统异常");
				}
			});
		 } catch(error) {
			   document.getElementById("police_add_btn").disabled = false;
			　　alert("添加警员信息：系统或数据异常");
			}
		});
		//点击保存
		$("#policeInfo_upodate_btn").click(function(){
			if(validate_update_form()==false){
				return ;
			}
			try{
			//授权询问室 S
			var inquestRoomName=$("#update_inquestRoomNo_select").val();
			//alert(inquestRoomName)
			//根据询问室名称 获取房间门禁控制器SN号 门禁控制门号
			var inquestRoomObj=getRoomInfoByName("${APP_PATH}/room/roomInfo/getRoomInfo",inquestRoomName)
			var CardNoStr=$("#policeCardNo1_update_input").val();
			var AccessSnStr=inquestRoomObj.roomAccessSN;
			var DoorNoStr=inquestRoomObj.roomAccessDoorNo;
			ploiceAuth('<%=GrantAuthURL%>',CardNoStr,AccessSnStr,DoorNoStr);
			//授权询问室 E
			document.getElementById("policeInfo_upodate_btn").disabled = true;
			//保存更新
			$.ajax({
				url:"${APP_PATH}/per/policeInfo/save?infoGUID="+$(this).attr("dataId"),
				type:"post",
				data:$("#policeUpdateModal form").serialize(),
				success:function(result){
					document.getElementById("policeInfo_upodate_btn").disabled = false;
					$('#policeUpdateModal').fadeOut(200);
					to_page(1)
					},
					error:function(){
						document.getElementById("policeInfo_upodate_btn").disabled = false;
						alert("操作失败：系统异常");
					}
				
				
			});
			} catch(error) {
				document.getElementById("policeInfo_upodate_btn").disabled = false;
			　　alert("修改警员信息：系统或数据异常");
			}
		});
		$(".tiptop a").click(function() {
			$(".tip").fadeOut(200);
		});
		$(".tiptop a").click(function() {
			$(".querlk").fadeOut(200);
		});
 
		//$(".sure").click(function() {
		//	$(".tip").fadeOut(100);
		//});

		$(".cancel").click(function() {
			$(".tip").fadeOut(100);
		});
		$(".leavecancel").click(function() {
			$(".querlk").fadeOut(100);
		});
		 
		$("#policeInfo_isLeave_btn").click(function() {
			try {
				//撤销授权询问室 S
	/* 			var inquestRoomName=$("#add_inquestRoomNo_select").val();
				alert(inquestRoomName)
				//根据询问室名称 获取房间门禁控制器SN号 门禁控制门号
				var inquestRoomObj=getRoomInfoByName("${APP_PATH}/room/roomInfo/getRoomInfo",inquestRoomName) */
				var policeObj=getPoliceById("${APP_PATH}/per/policeInfo/getPolice",$(this).attr("dataId"));
				var CardNoStr=policeObj.policeCardNo1;
				var AccessSnStr=policeObj.roomInfo.roomAccessSN;
				var DoorNoStr=policeObj.roomInfo.roomAccessDoorNo;
				ploiceAuth('<%=RevokeAuthURL%>',CardNoStr,AccessSnStr,DoorNoStr);
				//撤销授权询问室 E
				$.ajax({
					url:"${APP_PATH}/per/policeInfo/isLeave?infoGUID="+$(this).attr("dataId"),
					type:"post",
					data:$("#policeIsLeaveModal form").serialize(),
					success:function(result){
						parent.topFrame.location.reload();//刷新top页的在所人数
						$("#policeIsLeaveModal").fadeOut(100);
						to_page(1);
						}
				}); 
			} catch(error) {
			　　alert("确认离开：系统或数据异常");
			}
			
		});
		$("#shanchu").click(function() {
			delPolices();
		});
		var pageInfoJson=${pageInfoJson};
		build_page_nav(pageInfoJson);

	});
	//删除
	function delPolices(){
		var ids="";
		var checkboxs=$("input:checkbox[name='policeCheckbox']:checked");
		//alert(checkboxs.length);
		if(checkboxs.length<1){
			alert("请至少选择一条数据！");
			return false;
		}
		var r=confirm("确定要删除吗？")
		if(r==false){
			return;
		}
		$.each(checkboxs, function(index, item) {
			ids=ids+$(item).attr("dataId")+","
		});
		if(ids.indexOf(",")!=-1){
			ids=ids.substring(0,ids.length-1);
		}
		//删除
		$.ajax({
			url:"${APP_PATH}/per/policeInfo/delete",
			type:"post",
			data:{'ids':ids},
			success:function(result){
				parent.topFrame.location.reload();//刷新top页的在所人数
				$('#policeUpdateModal').fadeOut(200);
				to_page(1)
				}
			
		});
		
	}
</script>
<script type="text/javascript">
function getProjectInfo(id){
	$.ajax({
		url:"${APP_PATH}/per/policeInfo/getPolice?infoGUID="+id,
		type:"get",
		success:function(result){
			$("#policeName_update_input").val(result.policeName);
			$("#policeNo_update_input").val(result.policeNo);
			$("#policeCardID_update_input").val(result.policeCardID);
			$("#policeCardNo1_update_input").val(result.policeCardNo1);
			$("#policeOrg_update_input").val(result.policeOrg);
			$("#policeBringCount_update_input").val(result.policeBringCount);
			$("#policeBringInfo_update_input").val(result.policeBringInfo);
			$("#policeReason_update_input").val(result.policeReason);
			$("#fillInName_update_input").val(result.fillInName);
			$("#policeUpdateModal select").val([result.inquestRoomNo]);
		}
		
	});
}
function to_page(n){
    $("#pageNo").val(n);
    $("#searchForm").submit();
    return false;
}
function build_page_nav(pageInfo) {
	//$("#page_info_nav").empty();
	totalrecord=pageInfo.pages;
	var ul=$("#pageInfoId");
	ul.empty();
	var firstPageLi =$("<li></li>").addClass("paginItem").append($("<a ></a>").append("首页").attr("href","javascript:;"));
	var prePageLi =$("<li></li>").addClass("paginItem").append($("<a href='javascript:;'></a>").append("&laquo;"));
	if(pageInfo.hasPreviousPage==false){
		firstPageLi.addClass("disabled");
		prePageLi.addClass("disabled");
	}else{
		firstPageLi.click(
				function(){
					to_page(1);
				}		
				);
				prePageLi.click(
						function(){
							to_page(pageInfo.pageNum-1);
						});
	}
	
	var nextPageLi =$("<li></li>").addClass("paginItem").append($("<a href='javascript:;'></a>").append("&raquo;"));
	var lastPageLi =$("<li></li>").addClass("paginItem").append($("<a href='javascript:;'></a>").append("尾页").attr("href","#"));
	if(pageInfo.hasNextPage==false){
		nextPageLi.addClass("disabled");
		lastPageLi.addClass("disabled");
	}else{
		nextPageLi.click(function(){
			to_page(pageInfo.pageNum+1);
		});
		lastPageLi.click(function(){
			to_page(pageInfo.pages);
		});
	}
	
	ul.append(firstPageLi).append(prePageLi);
	$.each(pageInfo.navigatepageNums, function(index, item) {
			var numLi = $("<li></li>").addClass("paginItem").append($("<a href='javascript:;'></a>").append(item));
			if(pageInfo.pageNum == item){
				numLi.addClass("current");
			}
			numLi.click(function(){
				to_page(item);
			});
			ul.append(numLi);
		});
	ul.append(nextPageLi).append(lastPageLi);
    ul.appendTo("#page_info_nav");
}
function isLeave(id){
	//离开
/* 	var r=confirm('确认离开吗？');
	if(r==false){
		return;
	} */
	$("#policeIsLeaveModal form")[0].reset();
	$("#policeInfo_isLeave_btn").attr("dataId",id);
	$("#policeIsLeaveModal").fadeIn(200);

}
</script>
<style type="text/css">
.disabled{
    cursor: not-allowed;
    background-color: #eee;
    opacity: 1;
    color: #737373 !important;
}
.disabled a{
color: #737373 !important;}
.requiedCss{
display:inline;
/* float:left; */
color:red;
}
.textleft{
text-align: right;
padding-right:3px;
}
   .title{ 
    text-align: left !important;
    border-bottom: #999 1px solid;
    padding-top:0 !important; 
    height:15px !important; 
    }
     .title1{ 
    text-align: left !important;
    border-bottom: #999 1px solid;
    height:15px !important; 
    }
    .tip{
      height:390px;
    }
    .querlk{
     height:315px;
    }
</style>
</head>
<body>
	<div class="place">
		<ul class="placeul">

			<li>警员信息</li>
		</ul>
	</div>
	<div class="rightinfo">
	<form:form id="searchForm" modelAttribute="policeInfo" action="${APP_PATH}/per/policeInfo/list" method="post">
   <input id="isLeave" name="isLeave" type="hidden" value="0"/>
    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
	</form:form>
		<div class="tools">
			<ul class="toolbar">
				<li id="police_add_modal_btn"><span><img src="${APP_PATH}/static/images/t01.png" /></span>添加</li>
				<li id="police_update_modal_btn"><span><img src="${APP_PATH}/static/images/t02.png" /></span>修改</li>
				<li id="shanchu"><span><img src="${APP_PATH}/static/images/t03.png" /></span>删除</li>
			</ul>
		</div>
		<table class="imgtable" id="list">
			<tr class="imgtable1">
				<th width="60px;">序号</th>
				<th width="60px;">选择</th>
				<th>姓名</th>
				<th>警号</th>
				<th>询问室</th>
				<th>登记时间</th>
				<th>当前位置</th>
				<th>确认离开</th>
			</tr>
		<c:forEach items="${pageInfo.list}" var="policeInfo" varStatus="pageList">
			<tr>
			    <td>${(pageInfo.pageNum - 1) * pageInfo.pageSize + pageList.index + 1}</td>
				<td class="imgtd"><input type="checkbox" name="policeCheckbox" dataId="${policeInfo.infoGUID}"></td>
				<td>${policeInfo.policeName}</td>
				<td>${policeInfo.policeNo}</td>
				<td>${policeInfo.roomInfo.roomName}</td>
				<td>${policeInfo.inTime}</td>
				<td>${policeInfo.curPostion}</td>
				<td><input name="button"  type="button" class="btn ${policeInfo.isLeave=='1'?'disabled':''}"  ${policeInfo.isLeave=='1'?'disabled':""} id="button" onclick="isLeave('${policeInfo.infoGUID}')"
					value="确认离开" /></td>
			</tr>
			</c:forEach>
		</table>
		<div class="pagin">
			<div class="message">
				当前显示第&nbsp;<i class="blue">${pageInfo.pageNum}&nbsp;</i>页,共<i class="blue">${pageInfo.pages}</i>页,共<i class="blue">${pageInfo.total}</i>条记录，
			</div>
			<ul id="pageInfoId" class="paginList">
				<li class="paginItem"><a href="javascript:;"><span
						class="pagepre"></span></a></li>
				<li class="paginItem"><a href="javascript:;">1</a></li>
				<li class="paginItem current"><a href="javascript:;">2</a></li>
				<li class="paginItem"><a href="javascript:;">3</a></li>
				<li class="paginItem"><a href="javascript:;">4</a></li>
				<li class="paginItem"><a href="javascript:;">5</a></li>
				<li class="paginItem more"><a href="javascript:;">...</a></li>
				<li class="paginItem"><a href="javascript:;">10</a></li>
				<li class="paginItem"><a href="javascript:;"><span
						class="pagenxt"></span></a></li>
			</ul>
		</div>
		<div class="tip" id="policeUpdateModal">
			<div class="tiptop">
				<span>修改警员信息</span><a></a>
			</div>
			<div style="text-align: center; margin: auto">
		<form>
			<table width="650" border="1" class="zdgl" style="margin: auto;text-align: left;">
				<tr>
					<td colspan="9" class="title">基本信息：</td>
				</tr>
				<tr>
					<td class="textleft"><span class="requiedCss">*</span>姓名</td>
					<td colspan="2">
						<input name="policeName" type="text" maxlength="10" id="policeName_update_input"/>
					</td>
					<td class="textleft"><span class="requiedCss">*</span>警号</td>
					<td colspan="2">
						<input name="policeNo" type="text" maxlength="30" id="policeNo_update_input"/>
					</td>
					<td class="textleft"><span class="requiedCss">*</span>发卡卡号</td>
					<td colspan="2">
						<input name="policeCardNo1" type="text" maxlength="20" id="policeCardNo1_update_input"/>
					</td>
				</tr>
				 <tr>
					<td class="textleft">带领人数</td>
					<td colspan="2">
						<input name="policeBringCount" type="text" maxlength="3" id="policeBringCount_update_input"/>
					</td>
					<td class="textleft">单位</td>
					<td colspan="5">
					<input name="policeOrg" type="text" style="width: 361px" maxlength="25" id="policeOrg_update_input"/></td>
				</tr>
				<tr>
					<td class="textleft">携带人员</td>
					<td colspan="2"><input name="policeBringInfo" type="text" maxlength="25" id="policeBringInfo_update_input"/></td>
					<td class="textleft">案由</td>
					<td colspan="2"><input name="policeReason" type="text" maxlength="25" id="policeReason_update_input"/></td>
					<td class="textleft"><span class="requiedCss">*</span>填表人</td>
					<td colspan="2"><input name="fillInName" type="text" maxlength="25" id="fillInName_update_input"/></td>
				</tr>
				<tr>
					<td colspan="9" class="title1">权限：</td>
				</tr>
				<tr>
					<td class="textleft"><span class="requiedCss">*</span>询问室</td>
					<td  colspan="2">
						<select name="inquestRoomNo" id="update_inquestRoomNo_select"
						style="background-color: #E6E6E6; width: 123px;
						 height: 30px; padding-left: 5px; line-height: 30px">
						 <option value=""></option>
						 <c:forEach items="${inquestRoomInfoList}" var="inquestRoomInfo" varStatus="pageList">
							<option value ="${inquestRoomInfo.roomID}">${inquestRoomInfo.roomName}</option>
						</c:forEach>
						</select>
					</td>
					<td  colspan="6"></td>
				</tr>
			</table>
			</form>
		</div>
			<div class="tipinfo">
				<span><img src="${APP_PATH}/static/images/ticon.png" /></span>
				<div class="tipright">
					<p>是否确认对信息的修改 ？</p>
					<cite>如果是请点击确定按钮 ，否则请点取消。</cite>
				</div>
			</div>
			<div class="tipbtn">
				<input name="" type="button" class="sure" id="policeInfo_upodate_btn" value="确认修改" />&nbsp; <input
					name="" type="button" class="cancel" value="取消" />
			</div>
		</div>
	</div>
	<!--添加模态框  -->
	<div class="tip" id="policeAddModal">
		<div class="tiptop">
			<span>添加警员信息</span><a></a>
		</div>
		<div style="text-align: center; margin: auto">
		<form>
			<table width="650" border="1" class="zdgl" style="margin: auto">
				<tr>
					<td colspan="9" class="title">基本信息：</td>
				</tr>
				<tr>
					<td class="textleft"><span class="requiedCss">*</span>姓名</td>
					<td colspan="2"><input name="policeName" type="text" maxlength="10" id="policeName_add_input_id"/></td>
					<td class="textleft"><span class="requiedCss">*</span>警号</td>
					<td colspan="2"><input name="policeNo" type="text" maxlength="25" id="policeNo_add_input_id"/></td>
					<td class="textleft"><span class="requiedCss">*</span>发卡卡号</td>
					<td colspan="2"><input name="policeCardNo1" type="text" maxlength="25" id="policeCardNo1_add_input_id"/></td>
				</tr>
				<tr>
					<td class="textleft">带领人数</td>
					<td colspan="2"><input name="policeBringCount" type="text" maxlength="3" id="policeBringCount_add_input_id"/></td>
					<td class="textleft">单位</td>
					<td colspan="5"><input name="policeOrg" type="text"
						style="width:361px" maxlength="25" id="policeOrg_add_input_id"/></td>
				</tr>
				<tr>
					<td class="textleft">携带人员</td>
					<td colspan="2"><input name="policeBringInfo" type="text" maxlength="25"id="policeBringInfo_add_input_id"/></td>
					<td class="textleft">案由</td>
					<td colspan="2"><input name="policeReason" type="text" maxlength="25" id="policeReason_add_input_id"/></td>
					<td class="textleft"><span class="requiedCss">*</span>填表人</td>
					<td colspan="2"><input name="fillInName" type="text" maxlength="25" id="fillInName_add_input_id"/></td>
				</tr>
				<tr>
					<td colspan="9" class="title">权限：</td>
				</tr>
				<tr>
					<td class="textleft"><span class="requiedCss">*</span>询问室</td>
					<td colspan="2">
						<select name="inquestRoomNo" id="add_inquestRoomNo_select"
							style="background-color: #E6E6E6; width: 123px; height: 30px; padding-left: 5px; line-height: 30px">
							 <option value=""></option>
							<c:forEach items="${inquestRoomInfoList}" var="inquestRoomInfo" varStatus="pageList">
								<option value ="${inquestRoomInfo.roomID}">${inquestRoomInfo.roomName}</option>
							</c:forEach>
						</select>
					</td>
					<td colspan="6"></td>
				</tr>
			</table>
			</form>
		</div>
		<div class="tipinfo">
			<span><img src="${APP_PATH}/static/images/ticon.png" /></span>
			<div class="tipright">
				<p>是否确认对信息的添加 ？</p>
				<cite>如果是请点击确定按钮 ，否则请点取消。</cite>
			</div>
		</div>
		<div class="tipbtn">
			<input name="" type="button" id="police_add_btn" class="sure" value="添加" />&nbsp; <input
				name="" type="button" id="police_cancel_btn" class="cancel" value="取消" />
		</div>
	</div>
	<!--确认离开开始-->
	<div class="querlk" id="policeIsLeaveModal">
		<div class="tiptop">
			<span>提示信息</span><a></a>
		</div>
		<div style="height: 20px"></div>
		<!--确认离开表单内容-->
		<form>
		<div class="formbody">
			<ul class="forminfo">
				<li><label>离开原因</label> <input name="leaveReason" type="text"
					class="dfinput" /></li>
			</ul>
		</div>
		</form>
	<!--确认离开表单内容-->
		<div class="tipinfo">
			<span><img src="${APP_PATH}/static2/images/ticon.png" /></span>
			<div class="tipright">
				<p>是否确认离开 ？</p>
				<cite>如果是请点击确定按钮 ，否则请点取消。</cite>
			</div>
			<div class="tipkpzc">
				<input name="" type="button" class="sure" value="确认离开" id="policeInfo_isLeave_btn"/> &nbsp; <input
					name="" type="button" class="cancel leavecancel" value="取消" />
			</div>
		</div>
		<!--确认离开-->
		</div>
	<!-- 确认离开模态框 start -->
	<script type="text/javascript">
		/* $('.imgtable tbody tr:odd').addClass('odd'); */
		function validate_update_form(){
			var policeName= $("#policeName_update_input").val();
			var policeNo= $("#policeNo_update_input").val();
			//$("#policeCardID_update_input").val(result.policeCardID);
			var policeCardNo1= $("#policeCardNo1_update_input").val();
			var policeOrg=$("#policeOrg_update_input").val();
			var policeBringCount= $("#policeBringCount_update_input").val();
			 var policeBringInfo=$("#policeBringInfo_update_input").val();
			 var policeReason= $("#policeReason_update_input").val();
			var fillInName=$("#fillInName_update_input").val();
			var inquestRoomNo=$("#update_inquestRoomNo_select").val();
			//$("#policeUpdateModal select").val([result.inquestRoomNo]);
			if(policeName==""||policeName==null){
				show_validate_msg("姓名不能为空！");
				return false;
			}
			if(policeNo==""||policeNo==null){
				show_validate_msg("警号不能为空！");
				return false;
			}
			var regpoliceNo=/^[0-9a-zA-Z_]{1,}$/;
				if(!regpoliceNo.test(policeNo)){
				show_validate_msg("警号必须为字母数字或下划线！");
								return false;
					}
			if(policeCardNo1==""||policeCardNo1==null){
				show_validate_msg("发卡卡号不能为空！");
				return false;
			}
			if(validate_policeCardNo1(policeCardNo1)==false){
				show_validate_msg("发卡卡号未注册！");
				return false;
			}
				/* if(policeBringCount==""||policeBringCount==null){
				show_validate_msg("带领人数不能为空！");
				return false;
			} */
			if(policeBringCount!=""&& policeBringCount!=null){
				if(isNaN(policeBringCount)==true){
				  show_validate_msg("带领人数不能填写非数字！");
					return false;
				}
			}
				/* if(policeOrg==""||policeOrg==null){
				show_validate_msg("单位不能为空！");
				return false;
			} */
			/* if(policeBringInfo==""||policeBringInfo==null){
				show_validate_msg("携带人员信息不能为空！");
				return false;
			}
			if(policeReason==""||policeReason==null){
				show_validate_msg("案由不能为空！");
				return false;
			} */
			if(fillInName==""||fillInName==null){
				show_validate_msg("填表人不能为空！");
				return false;
			}
			
			if(inquestRoomNo==""||inquestRoomNo==null){
				show_validate_msg("询问室不能为空！");
				return false;
			}
			return true;
		}
		function validate_add_form(){
			var policeName=$("#policeName_add_input_id").val();
			var policeNo=$("#policeNo_add_input_id").val();
			var policeCardNo1=$("#policeCardNo1_add_input_id").val();
			var policeBringCount=$("#policeBringCount_add_input_id").val();
			var policeOrg=$("#policeOrg_add_input_id").val();
			var policeBringInfo=$("#policeBringInfo_add_input_id").val();
			var policeReason=$("#policeReason_add_input_id").val();
			var fillInName=$("#fillInName_add_input_id").val();
			var inquestRoomNo=$("#add_inquestRoomNo_select").val();
			
			if(policeName==""||policeName==null){
				show_validate_msg("姓名不能为空！");
				return false;
			}
			if(policeNo==""||policeNo==null){
				show_validate_msg("警号不能为空！");
				return false;
			}
			var regpoliceNo=/^[0-9a-zA-Z_]{1,}$/;
				if(!regpoliceNo.test(policeNo)){
				show_validate_msg("警号必须为字母数字或下划线！");
								return false;
					}
			if(policeCardNo1==""||policeCardNo1==null){
				show_validate_msg("发卡卡号不能为空！");
				return false;
			}
			if(validate_policeCardNo1(policeCardNo1)==false){
				show_validate_msg("发卡卡号未注册！");
				return false;
			}
/* 				if(policeBringCount==""||policeBringCount==null){
				show_validate_msg("带领人数不能为空！");
				return false;
			} */
			if(policeBringCount!=""&& policeBringCount!=null){
				if(isNaN(policeBringCount)==true){
				  show_validate_msg("带领人数不能填写非数字！");
					return false;
				}
			}
			/* if(policeOrg==""||policeOrg==null){
				show_validate_msg("单位不能为空！");
				return false;
			}
			if(policeBringInfo==""||policeBringInfo==null){
				show_validate_msg("携带人员信息不能为空！");
				return false;
			}
			if(policeReason==""||policeReason==null){
				show_validate_msg("案由不能为空！");
				return false;
			} */
			if(fillInName==""||fillInName==null){
				show_validate_msg("填表人不能为空！");
				return false;
			}
			if(inquestRoomNo==""||inquestRoomNo==null){
				show_validate_msg("询问室不能为空！");
				return false;
			} 
			return true;
		}
		//ajax校验，卡号1.是否存在
		function validate_policeCardNo1(cardNo1){
			
			var policeCardNo1flag=true;
			$.ajax({
				url:"${APP_PATH}/card/cardRegInfo/isExsitCardNo",
				type:"post",
				 cache: false,
			     async: false,
				data:{'cardNo1':cardNo1},
				success:function(result){
					if(result.code!=100){
						policeCardNo1flag=false;
				}
			 },
			 error: function() { 
				 show_validate_msg("验证失败!,请联系管理员");
				} 
			});
			return policeCardNo1flag;
		}
		//提示框显示信息
		function show_validate_msg(msg){
			var extendMsg="<span style='font-weight:bold; font-size:14px'>"+msg+"</span>";
			$.jBox.info(msg,"错误" );
		}
	</script>
</body>
</html>
